$(function(){
	$('#userTable').datagrid({
		title : '用户管理列表',
		iconCls:'icon-save',
		width : '95%',
		height: graidHight(0.93),
		nowrap: true,
		autoRowHeight: false,
		striped: true,
		collapsible:false,
		url:'json/datagrid_data2.json',
		idField:'itemid',
		frozenColumns:[[
		    {field:'ck',checkbox:true}
		]],
		columns:[[
		    {field:'itemid',title:'Item ID',width:80},
			{field:'productid',title:'Product ID',width:120},
			{field:'listprice',title:'List Price',width:80,align:'right'},
			{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
			{field:'attr1',title:'Attribute',width:250},
			{field:'status',title:'Status',width:60,align:'center'}    
		]],
		pagination:true,
		rownumbers:true,
		toolbar:[{
			id:'btnadd',
			text:'Add',
			iconCls:'icon-add',
			handler:function(){
				$('#btnsave').linkbutton('enable');
				alert('add')
			}
		},{
			id:'btncut',
			text:'Cut',
			iconCls:'icon-cut',
			handler:function(){
				$('#btnsave').linkbutton('enable');
				alert('cut')
			}
		},'-',{
			id:'btnsave',
			text:'Save',
			disabled:true,
			iconCls:'icon-save',
			handler:function(){
				$('#btnsave').linkbutton('disable');
				alert('save')
			}
		}]
	});
});

//设置graid页的高度
function graidHight(percent) {
	var hight = parent.document.body.clientHeight - 140;
	return hight * percent;
}